<template>
	<view class="report">
		<view v-if="show">
			<view>
				{{$t('请选择投诉该账号的原因')}}:
			</view>
			<view class="box">
				<block v-if="lang==='zh'">
					<view class="listed" v-for="(item,index) in list" :key="index" @click="show = !show">{{item}}</view>
				</block>
				<block v-if="lang !='zh'">
					<view class="listed" v-for="(item,index) in list_ru" :key="index" @click="show = !show">{{item}}</view>
				</block>
			</view>
		</view>
		<view v-if="!show">
			<view>{{$t('图片证据')}}</view>
			<view class="picture">
				<u-upload :action="action" :file-list="fileList" :limitType="limitType" :max-count="imageMaxCount"
					:max-size="imageMaxSize" @on-success="success" :upload-text="uploadText"></u-upload>
			</view>
			<view>{{$t('投诉内容')}}<text style="color: red;font-size: 24rpx;margin-left: 20rpx;">({{$t('必填')}})</text></view>
			<view style="background-color: white;margin: 20rpx 0 20rpx 0;">
				<u-input :placeholder="$t('请输入内容')" v-model="value" :type="type" :border="border" :height="height" :auto-height="autoHeight" maxlength="200" />
			</view>
			<view class="submit" @click="submit">{{$t('提交')}}</view>
		</view>
	</view>
</template>

<script>
	import {
		HTTP_REQUEST_URL,
		IMAGE_MAX_COUNT,
		IMAGE_MAX_SIZE
	} from "@/config/app";
	export default {
		data() {
			return {
				lang:getApp().globalData.lang,
				list: ['发布不适当内容对我造成骚扰', '存在欺诈骗钱行为', '此帐号可能被盗用了', '存在侵权行为', '发布仿冒品信息', '冒充他人', '其他违规内容'],
				list_ru: ['Неподобающий контент', 'Мошенническая афера с деньгами', 'Возможно, эта учетная запись была украдена', 'Нарушение прав', 'Размещение информации о подделках', 'Выдает себя за другого человека', 'Другие нарушения'],
				show: true,
				action: HTTP_REQUEST_URL + '/common/upload',
				imageMaxSize: IMAGE_MAX_SIZE,
				imageMaxCount: IMAGE_MAX_COUNT,
				value: '',
				type: 'textarea',
				border: true,
				height: 200,
				autoHeight: true,
				report:false,
			};
		},
		onLoad() {
			this.$u.api.user.appCheck().then(res=>{
				this.report = res.report
			})
		},
		onReady() {
			uni.setNavigationBarTitle({
			    title: this.$t("举报")
			})
		},
		methods: {
			bindTextAreaBlur: function(e) {
				console.log(e.detail.value)
			},
			submit(){
				if(this.value == ''){
					this.$u.toast("内容不能为空")
				}else{
					this.$u.toast("提交成功")
					setTimeout(()=>{
						uni.switchTab({
						  url: '/pages/tabbar/index'
						})
					},300)
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.report {
		min-height: 100vh;
		background-color: #f5f5f5;
		padding: 20rpx;
	}

	.box {
		background-color: white;
		margin-top: 20rpx;
		border-radius: 20rpx;
		padding: 20rpx;
	}

	.listed {
		height: 70rpx;
		line-height: 70rpx;
	}

	.listed:not(:last-child) {
		border-bottom: 2rpx solid #e7e4e4;
		box-sizing: border-box;
	}

	.picture {
		margin: 30rpx 0 30rpx 0;
		min-height: 200rpx;
		border-radius: 20rpx;
		background-color: white;
	}
	.submit{
		width: 100%;
		height: 60rpx;
		line-height: 60rpx;
		text-align: center;
		 background: linear-gradient(134deg, #DE2D11 0%, #FDB22F 100%);
		margin-top: 100rpx;
		border-radius: 20rpx;
		color: white;
	}
</style>